home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
misc
/
dspice0s
/
memadj.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-21
|
3KB
|
96 lines
/* memadj.f -- translated by f2c (version of 3 February 1990 3:36:42).
You must link the resulting object file with the libraries:
-lF77 -lI77 -lm -lc (in that order)
*/
#include "f2c.h"
/* Common Block Declarations */
struct {
doublereal cpyknt;
integer istack[1], lorg, icore, maxcor, maxuse, memavl, ldval, numblk,
loctab, ltab, ifwa, nwoff, ntab, maxmem, memerr, nwd4, nwd8,
nwd16;
} memmgr_;
#define memmgr_1 memmgr_
/* Table of constant values */
static integer c__1 = 1;
static integer c__0 = 0;
/*< subroutine memadj >*/
/* Subroutine */ int memadj_()
{
/* System generated locals */
integer i_1, i_2;
/* Local variables */
static integer ltab1;
extern /* Subroutine */ int copy4_();
static integer memdec, memdel;
extern /* Subroutine */ int comprs_();
extern integer nxtmem_();
extern /* Subroutine */ int memory_();
static integer nwords;
/*< implicit double precision (a-h,o-z) >*/
/* spice version 2g.6 sccsid=memmgr 3/15/83 */
/*< common /memmgr/ cpyknt,istack(1),lorg,icore,maxcor,maxuse,memavl, >*/
/*< 1 ldval,numblk,loctab,ltab,ifwa,nwoff,ntab,maxmem,memerr,nwd4, >*/
/*< 2 nwd8,nwd16 >*/
/*< 50 maxuse=max0(maxuse,(ldval-memavl-ifwa)) >*/
/* L50: */
/* Computing MAX */
i_1 = memmgr_1.maxuse, i_2 = memmgr_1.ldval - memmgr_1.memavl -
memmgr_1.ifwa;
memmgr_1.maxuse = max(i_2,i_1);
/*< memdec=2*nxtmem(1) >*/
memdec = nxtmem_(&c__1) << 1;
/*< if (memavl.lt.memdec) return >*/
if (memmgr_1.memavl < memdec) {
return 0;
}
/* ... compress current allocations of memory */
/*< call comprs(0,ldval) >*/
comprs_(&c__0, &memmgr_1.ldval);
/* ... adjust memory size */
/*< memdel=0 >*/
memdel = 0;
/*< 60 icore=icore-memdec >*/
L60:
memmgr_1.icore -= memdec;
/*< memdel=memdel+memdec >*/
memdel += memdec;
/*< memavl=memavl-memdec >*/
memmgr_1.memavl -= memdec;
/*< if (memavl.ge.memdec) go to 60 >*/
if (memmgr_1.memavl >= memdec) {
goto L60;
}
/*< ltab1=ldval-ntab >*/
ltab1 = memmgr_1.ldval - memmgr_1.ntab;
/*< istack(ltab1+2)=istack(ltab1+2)-memdel >*/
memmgr_1.istack[ltab1 + 1] -= memdel;
/* ... relocate block entry table */
/*< nwords=numblk*ntab >*/
nwords = memmgr_1.numblk * memmgr_1.ntab;
/*< cpyknt=cpyknt+dble(nwords) >*/
memmgr_1.cpyknt += (doublereal) nwords;
/*< call copy4(istack(loctab+1),istack(loctab-memdel+1),nwords) >*/
copy4_(&memmgr_1.istack[memmgr_1.loctab], &memmgr_1.istack[
memmgr_1.loctab - memdel], &nwords);
/*< loctab=loctab-memdel >*/
memmgr_1.loctab -= memdel;
/*< ldval=ldval-memdel >*/
memmgr_1.ldval -= memdel;
/*< call memory >*/
memory_();
/*< return >*/
return 0;
/*< end >*/
} /* memadj_ */